#include <stdio.h>
int len(char *s);
int Valid(char *s);
int main(void)
{
    char str[500];
    int N,i,num=0;
    scanf("%d",&N);
    getchar();
    for(i=0;i<N;i++)
    {
        gets(str);
        num+=Valid(str);
    }
    printf("Valid:%d\n",num);
    printf("Invalid:%d",N-num);
    return 0;
}
int Valid(char *s)
{
    int flag=1,n,i;
    if(*s=='_'||*s>='A'&&*s<='Z'||*s>='a'&&*s<='z');
    else
        flag=0;
    n=len(s);
    for(i=1;i<n;i++)
    {
        if(*(s+i)=='_'||*(s+i)>='A'&&*(s+i)<='Z'||*(s+i)>='a'&&*(s+i)<='z'||*(s+i)>='0'&&*(s+i)<='9');
        else
            flag=0;
    }
    return flag;
}
int len(char *s)
{
    char *p;
    p=s;
    while(*p!='\0')
        p++;
    return p-s;
}

